﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectGoods.aspx.cs" Inherits="HZ.Supervise.Web.Common.SelectGoods" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">    
    <title>选择药品</title>
    <link rel="stylesheet" type="text/css" href="../Style/global.css" />

    <script type="text/javascript" src="../Scripts/Common.js"></script>

    <script type="text/javascript" src="../Scripts/global.js"></script>

    <script type="text/javascript" src="../Scripts/jquery.js"></script>

    <script type="text/javascript" src="../Scripts/MainListSelect.js"></script>
    <script type="text/javascript" language="javascript">

        function addCompanyInfo() {
            var HospitalId = document.getElementById("hidAll");
            var HospitalName = document.getElementById("hidAllName");
            var aa = HospitalId.value;
            var bb = HospitalName.value;
            document.write(aa);
            document.write(bb);
            if (aa == null || aa == "") {
                alert("请选择药品");
            }
            window.parent.insertGoodsInfo(aa, bb);
            window.parent.hidePopWin(false);
//            opener.insertGoodsInfo(aa, bb);
//            window.close();
        }
        //回车查询
        //by张雄    2011.5.18
        function document.onkeydown() {
            var btn = document.getElementById('<%=btnselect.ClientID %>');  //获取服务器控件的对象
            if (event.keyCode == 13) {
                btn.click();
                event.returnValue = false;  //阻止浏览器执行与事件相关的动作
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table class="querylist">
    <tr>
    <td>药品名称：</td>
    <td>
        <asp:TextBox ID="txtProductName" runat="server" Width="183px"></asp:TextBox>
        </td>
    <td>
        <asp:Button ID="btnselect" runat="server" CssClass="btn" Text="查询" 
            onclick="btnselect_Click" />
        </td>
    </tr>
    </table>
        <table class="querylist">
        <tr>
            <th>已选择药品</th><th>药品列表</th></tr>
            <td width="30%" >
                <asp:ListBox ID="lbCompany" Width="100%"  runat="server" Height="275px" CssClass="mainlist" ></asp:ListBox>
            </td>
    <td width="70%">
    <asp:GridView ID="gvwGoods"  CssClass="mainlist" runat="server" AutoGenerateColumns="False"
        EmptyDataText="暂无有效的信息！"  Width="100%" DataKeyNames="GoodsId" 
         onrowdatabound="gvwGoods_RowDataBound" >        
        <Columns>       
             <asp:TemplateField HeaderText="序号">
                 <ItemTemplate>                 
                     <%# Container.DataItemIndex + 1 + AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1)%>
                 </ItemTemplate>
                 <HeaderStyle Width="30px" />
            </asp:TemplateField>
               <asp:TemplateField >
                    <HeaderTemplate>
                      <%--  <input id="chkAllHospital" name="chkAll" type="checkbox"  title="inputall"  />--%>
                        <%--<asp:CheckBox ID="chkAllCompany" runat="server"   OnCheckedChanged="chkAllCompany_OnCheckedChanged" AutoPostBack="true"/>--%>
                        <asp:Button ID="chkAll" runat="server" OnClick="chkAll_OnClick" CssClass="btn" Text="全选"/>
                        <asp:Button ID="UnchkAll" runat="server" OnClick="UnchkAll_OnClick" CssClass="btn"  Text="全不选"/>
                    </HeaderTemplate>
                    <ItemTemplate>
                       <%--<input id="chkHospital" name="chkHospital" type="checkbox"  value='<%# Eval("HospitalID") %>|<%# Eval("HospitalName") %>'  title="input"  onchange="chkHospital_onchange"  onclick="chkHospital_onclick"     />--%>
                       <asp:CheckBox  runat="server" ID="chkCompany"   OnCheckedChanged="chkCompany_OnCheckedChanged"  AutoPostBack="true" />
                       <asp:HiddenField ID="HidID" runat="server" Value='<%# Eval("GoodsID") %>' /> 
                        <asp:HiddenField ID="HidName" runat="server" Value='<%# Eval("ProductName") %>' /> 
                    </ItemTemplate>
                    <HeaderStyle  Width="200px" />
                </asp:TemplateField>           
            <asp:BoundField HeaderText="药品名称" DataField="ProductName" />            
        </Columns>
    </asp:GridView>
            </td>
        </tr>
      </table>
     <asp:HiddenField ID="hidAll" runat="server" EnableViewState="true" />
    <asp:HiddenField ID="hidAllName" runat="server" EnableViewState="true" />
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server"  OnPageChanged="AspNetPager1_OnPageChanged">
        </webdiyer:AspNetPager>
    </div> 
    <div class="listctrl" style="text-align:center">
        <input id="btnConfirm" type="button" value="确定选择" onclick="javascript:addCompanyInfo();"
            class="btn" />
        <input id="Button1" type="button" onclick="openner=null; window.parent.hidePopWin(false);" value="取消"
            class="btn"  />
   </div>
    </form>
</body>
</html>
